//
// Created by zhupi on 2024/10/1.
//

#include "center_window.h"
#include <QPushButton>
#include "file_open_dialog_view_ctrl.h"
#include "edit_library_dialog_view_ctrl.h"
#include "add_propertes_dialg_view_ctrl.h"
#include "properts_dialog_view_ctrl.h"
#include "import_project.h"

#include "vdanced_dialog_view_ctrl.h"
#include "mutil_contens_dialog.h"

CenterWindow::CenterWindow(QWidget *parent) : QWidget(parent){

}

void CenterWindow::Initial() {

    QHBoxLayout *hbox = new QHBoxLayout;

    QPushButton *button  = new QPushButton("dfsafdsafd", this);
//    connect(button, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), &FileOpenDialogViewCtrl::GetIns().Initial);
    connect(button, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), []()->void{
        MaterialDialogViewCtrl::GetIns().Initial("fdsafdsadf", 123);
    });
    hbox->addWidget(button);

    QPushButton *button1  = new QPushButton("proper", this);
//    connect(button, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), &FileOpenDialogViewCtrl::GetIns().Initial);
    connect(button1, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), []()->void{
        PropertsDialogViewCtrl::GetIns().Initial();
    });
    hbox->addWidget(button1);

    QPushButton *import  = new QPushButton("import", this);
//    connect(button, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), &FileOpenDialogViewCtrl::GetIns().Initial);
    connect(import, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), [&]()->void{
//        ImportProject *dialog = new ImportProject(this);
//        dialog->exec();

        MutilContensDialog *mutiDialog = new MutilContensDialog("this", nullptr);
        mutiDialog->Init();

        // std::vector<std::pair<QString, QStringList>> &dataList
        std::vector<std::pair<QString, QStringList>> dataList { {"111", {"111", "2222", "3333"}}, {"111", {"111", "2222", "mmmmm"}},
                                                                {"111", {"111", "2222", "iiii"}}};
        mutiDialog->SetLeftData(dataList);
        mutiDialog->exec();
//        PropertsDialogViewCtrl::GetIns().Initial();
    });
    hbox->addWidget(import);

    QPushButton *setup  = new QPushButton("vanteg", this);
//    connect(button, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), &FileOpenDialogViewCtrl::GetIns().Initial);
    connect(setup, &QPushButton::clicked, &FileOpenDialogViewCtrl::GetIns(), [&]()->void{
        VdancedDialogViewCtrl::GetIns().Initial();
    });

    hbox->addWidget(import);

    this->setLayout(hbox);

//
//    QMainWindow *centerWindow = new QMainWindow(this);
//    QWidget *center = new QWidget(centerWindow);
//    centerWindow->setCentralWidget(center);
//
////    this->setStyleSheet("background-color: red;");
//    MessageWindow *messageWindow = new MessageWindow(centerWindow);
//    messageWindow->Initial();
//    messageWindow->setMinimumHeight(300);
//    centerWindow->addDockWidget(Qt::BottomDockWidgetArea, messageWindow);
//
//    centerWindow->show();
}
